Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary of changes
During testing with my test shield on LPC1768, I noticed an odd issue with SPI: if I set the bus to 16-bit mode and did a transactional transfer, each byte was sent in its own 16-bit word instead of the 16-bit words going out the wire as intended. For example, if I did transfer of [0x1234, 0x5678] with SPI, the logic analyzer would see [0x0034, 0x0012, 0x0078, 0x0056].
As it turns out, this is because of a for loop in the LPC1768 spi_api that has been messed up since its inception. Regardless of what transfer width the bus was set to, it was always looping through each byte of the data and writing that byte individually to the SPI registers.
To fix this, I rewrote the for loop to use a different implementation for transfer width >8 bits. This ensures that the 16-bit words get copied correctly.
I also fixed #255 for this target by implementing spi_get_peripheral_name().
Impact of changes
Migration actions required
Documentation
None
Pull request type
Test results
CI shield SPI-basic test now passes for LPC1768
Reviewers